program lagrangean

    use global
    use io, only: init, lat, lon
    use track, only: track_particle

    implicit none

    integer :: i0, j0, k0, l0
    integer :: i, j
    real :: rx0, ry0, rz0

    call init()

    ! Seed 30S, 0E.
    do i=1,idm
        if (lon(i) >= 0.0) then
            i0 = i
            goto 10
        endif
    enddo
    10 continue
    rx0 = (0.0 - lon(i0-1))/(lon(i0) - lon(i0-1))
    do j=1,jdm
        if (lat(j) >= -30.0) then
            j0 = j
            goto 20
        endif
    enddo
    20 continue
    ry0 = (-30.0 - lat(j0-1))/(lat(j0) - lat(j0-1))

    l0 = 1
    rz0 = 0.5

    do k0=1,kdm,10
        call track_particle(i0, j0, k0, l0, rx0, ry0, rz0)
    enddo

end program lagrangean
